<?php

namespace App\Util;


class Login3
{
	public function qq($open_id, $token, $app_id, $app_key){
		$uri = "/v3/user/get_info";
		$step1 =  urlencode($uri);

		$uriquery = "appid={$app_id}&format=json&openid={$open_id}&openkey={$token}&pf=qzone&userip=182.149.161.217";
		$step3 = urlencode($uriquery);
		$so = "GET&{$step1}&{$step3}";
		$sig = base64_encode(hash_hmac('sha1', $so, "{$app_key}&", true));
		$url = "http://openapi.tencentyun.com".$uri."?".$uriquery."&sig=".urlencode($sig);

		$rep = file_get_contents($url);
		return $rep;
	}

	public function weixin($open_id, $token){

		$url = "https://api.weixin.qq.com/sns/userinfo?access_token={$token}&openid={$open_id}";
		$rep = (new Fun)->postCurl($url);
		return $rep;
	}


}
